#!/usr/bin/env python 
#
# UFPE - CIn
#
# Equipe:
# Andre Braga    - login?
# Andre Guedes   - agl
# David Aragao   - dlla
# Jesus Palencia - jspff

import urllib2
import cookielib
import time

class HttpClient:
    
    def __init__(self, target):
        self.target = target
        
    def do_request(self, url, service):
        time.sleep(1)
        hijacked_cookies = cookielib.MozillaCookieJar()
        if service == "orkut":
            hijacked_cookies.load("./cookies/orkut.txt")
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(hijacked_cookies))
        try:
            file_handle =  opener.open(self.target + url)
            html = file_handle.read()
        except:
            html = ""
        return html

# EOF
